package com.starry.module.system.config;

import com.starry.core.redis.service.CurrentTenantDbInfo;
import com.starry.core.tenant.config.TenantProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Set;

/**
 * 自动装配
 *
 * @Author xiaoke
 */
@Configuration
public class SystemAutoConfig {

    private final TenantProperties tenantProperties;

    public SystemAutoConfig(TenantProperties tenantProperties) {
        this.tenantProperties = tenantProperties;
    }

    @Bean
    public CurrentTenantDbInfo currentTenantInfo() {
        return new CurrentTenantDbInfo() {
            @Override
            public Set<String> getIgnoreCaches() {
                return tenantProperties.getIgnoreCaches();
            }
        };
    }
}
